package com.innext.kjqb.ui.authentication_new.presenter;

import com.innext.kjqb.base.BasePresenter;
import com.innext.kjqb.http.HttpManager;
import com.innext.kjqb.ui.authentication_new.bean.FirstVerificationInfoBean;
import com.innext.kjqb.http.HttpSubscriber;
import com.innext.kjqb.ui.authentication_new.contract.AuthenticationCenterContract;

/**
 * Created by gyl on 2017/6/14 0014.
 */

public class AuthenticationCenterPresenter extends BasePresenter<AuthenticationCenterContract.View> implements AuthenticationCenterContract.presenter {

    @Override
    public void getAuthenticationCenter() {
        toSubscribe(HttpManager.getApi().getFirstVerificationInfo(), new HttpSubscriber<FirstVerificationInfoBean>() {
            @Override
            protected void _onStart() {
            }

            @Override
            protected void _onNext(FirstVerificationInfoBean firstVerificationInfoBean) {
                if (firstVerificationInfoBean != null) {
                    mView.AuthenticationCenterSccess(firstVerificationInfoBean);
                } else {
                    mView.showErrorMsg("数据获取失败，请重新获取", null);
                }
            }

            @Override
            protected void _onError(String message) {
                mView.showErrorMsg(message,null);
            }

            @Override
            protected void _onCompleted() {
            }
        });
    }
}
